package scuts.core.lifting;
using scuts.core.Zip;

using scuts.core.extensions.Ints;

class LiftWithArray1 
{

  // lifts a function working with pure values into a monadic one, working
  // with Arrays of pure values
  public static function liftWithArray <A, B> (f:A->B):Array<A>->Array<B> 
  {
    return function (a:Array<A>) {
      var res = [];
      for (e in a) {
        res.push(f(e));
      }
      return res;
    }
  }

}

class LiftWithArray2 
{

  public static function liftWithArray <A, B, C> (f:A->B->C):Array<A>->Array<B>->Array<C> 
  {
    return function (a:Array<A>, b:Array<B>) {
      return a.zipWith(b, f);
    }
  }

}